﻿Imports System.Collections

Partial Class Movimientos
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Not IsPostBack Then

            Dim BS_persona As New WebCredit.BusinessRule.Person
            Dim personas As New System.Collections.Generic.List(Of WebCredit.EntityClass.Person_Entity)()
            Dim persona As New WebCredit.EntityClass.Person_Entity

            personas = BS_persona.GetAll()

            DropDownList1.Items.Clear()

            For Each persona In personas
                Dim item As New System.Web.UI.WebControls.ListItem()
                item.Text = persona.Nombre
                item.Value = persona.id_Persona

                DropDownList1.Items.Add(item)

            Next

            Dim LinqCC As New LINQ_CuentaCorrienteDataContext
            GridView1.DataSource = LinqCC.sp_VistaMovimientoByID(DropDownList1.SelectedValue)
            GridView1.DataBind()

        End If

    End Sub

    Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged

        Dim LinqCC As New LINQ_CuentaCorrienteDataContext
        GridView1.DataSource = LinqCC.sp_VistaMovimientoByID(DropDownList1.SelectedValue)
        GridView1.DataBind()
    End Sub
End Class
